﻿@model MVCGridGridViewTest.Controllers.ModelWrapper
@using MVCUI
<!DOCTYPE html>

<html>
<head>
    
    <link href="~/bootstrap.css" rel="stylesheet" />
    <script src="~/jquery-1.7.2.min.js"></script>
    <script src="~/jquery-ui-1.8.11.min.js"></script>
    <script src="~/bootstrap.min.js"></script>


    <link href="~/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
    <title>test</title>
</head>
<body>
    <script type="text/javascript">
        
    </script>
    
    @helper DeleteTemplate(MVCGridGridViewTest.Controllers.Person row) {
    <div>
      <form style="display:none;" name="DeleteId@(row.Id)" action="/home/index" method="post">
        <input type='text' name='deleteid' id="deleteid" value="@row.Id" />
      </form>
        <a href="javascript:  document.DeleteId@(row.Id).submit();"  class="btn btn-primary">Delete record</a>
    </div>
            
    }
    
    <div style="width:500px;">
                   @{
                            
                        DataGridColumns col = new DataGridColumns();
                        col.AddColumn(new PredefinedColumn(PreDefinedColumnsTypes.Select, ""));
                        col.AddColumn(new TextColumn("Imie", "Name", attributes: new { cl = "somesl" }));
                        col.AddColumn(new DropDownColumn("Country", "Country", Model.Countries, "Name", "Id"));
                        col.AddColumn(new DateColumn("Czas", "BirthDate", (x) => { return x.ToString("yyyy-MM-dd"); }));
                        col.AddColumn(new DropDownColumn2("Pet", "PetName", "PetId", Model.Pets, "Name", "Id"));
                        col.AddColumn(new BoolColumn("Married", "IsMaried"));
                        col.AddColumn(new PredefinedColumn(PreDefinedColumnsTypes.Delete, "Usuń"));
                        col.AddColumn(new PredefinedColumn(PreDefinedColumnsTypes.Edit, "Edycja"));
                        
                        
                        GridConfiguration gc= new GridConfiguration();
                        gc.UpdateAction = "/home/index";
                        
                        gc.DeleteAction = "/home/index";
                        gc.JQueryDatePickerOptions = "dateFormat: 'yy-mm-dd'";
                 
                        @Html.DataGridView(@Model.personList.AsQueryable(), "gridview", gc, col)
                        
                    }

    </div>

        <div style="width:500px;">
                   @{
                            
                        gc.UpdateAction = "/home/index";     
                        gc.PageSize=3;              
                        //, (x) => { return DeleteTemplate(x); }
                        @Html.DataGridView(@Model.personList.AsQueryable(), "gridview2", gc, col)
                        
                    }

    </div>
    

</body>
</html>
